<template>
	<view class="pad-lr-32 pad-tb-32">
		<view class=" pad-lr-20 pad-tb-20 " v-if="content">
			<rich-text :nodes="content"></rich-text>
		</view>
		<view class="text-align-center pad-tb-40" v-else-if="loading">
			<text class="fontSize-28 col-6">加载中...</text>
		</view>
		<view class="text-align-center pad-tb-40" v-else>
			<text class="fontSize-28 col-6">暂无内容</text>
		</view>
	</view>
</template>

<script lang="ts" setup>
import { onLoad } from '@dcloudio/uni-app';
import {noticelnfo} from '@/utils/api'
import { ref } from 'vue';
onLoad((options)=>{
	id.value = options.id
	_noticelnfo()
})
const id = ref()
const content = ref('')
const loading = ref(true)
const _noticelnfo =() =>{

	loading.value = true
	noticelnfo({id:id.value}).then(res=>{
		console.log('API返回结果:', res)
		if(res.code==1 && res.data && res.data.notice){
			content.value = res.data.notice.content || ''
		} else {
			console.error('获取公告信息失败:', res.msg)
			content.value = ''
		}
	}).catch(err => {
		console.error('获取公告信息出错:', err)
		content.value = ''
	}).finally(() => {
		loading.value = false
	})
}
</script>

<style lang="scss">
page{
	// background:#f6f6f6;
}
</style>
